<?php

namespace Yi\Permission\Support\Aliyun;

use OSS\OssClient as BaseOssClient;

class OssClient
{
    public static $OSS;

    public static function putObject($filename, $content, $option = [])
    {
        return self::OSSClient()->putObject(env('ALIYUN_OSS_BUCKET'), $filename, $content, $option);
    }

    public static function OSSClient()
    {
        return self::$OSS ?: self::$OSS = new BaseOssClient(env('ALIYUN_ACCESS_KEY_ID'), env('ALIYUN_ACCESS_KEY_SECRET'), env('ALIYUN_OSS_ENDPOINT'));
    }
}
